package 比屋作业.day13;

public class D13_1 {
    public static void main(String[] args) {
        Rectangle rectangle1=new Rectangle(4,5);
        Rectangle rectangle2=new Rectangle(3,8);
        rectangle1.printInof();
        rectangle2.printInof();
        System.out.println(rectangle1.equals(rectangle2));
    }
}
abstract class shape{
    public abstract void printInof();
}
class Rectangle extends shape{
    private double chang;
    private double kuan;
    public Rectangle(double chang,double kuan){
        this.chang=chang;
        this.kuan=kuan;
    }

    public double getChang() {
        return chang;
    }

    public double getKuan() {
        return kuan;
    }

    @Override
    public void printInof() {
        System.out.println(toString());
    }

    @Override
    public String toString() {
        return "长为："+chang+"宽为："+kuan;
    }

    @Override
    public boolean equals(Object obj) {
        Rectangle rectangle=(Rectangle) obj;
        return this.chang==rectangle.chang&&this.kuan==rectangle.kuan;
    }
}